﻿Imports SdlDotNet.Graphics
Imports SdlDotNet.Graphics.Sprites
Imports System.Drawing

Public Class MultilineMessageBox
    Private TextSprites(4) As TextSprite
    Private InactiveLineFont As SdlDotNet.Graphics.Font
    Private ActiveLineFont As SdlDotNet.Graphics.Font

    Public Sub New(ByVal position As Point)
        InactiveLineFont = FontFactory.PlainSmall()
        ActiveLineFont = FontFactory.BoldSmall()

        For i As Integer = 0 To TextSprites.Length - 1
            TextSprites(i) = New TextSprite("", InactiveLineFont, Color.Black, True, New Point(position.X, position.Y + (i * 20)))
        Next

        TextSprites(4).Font = ActiveLineFont
        ClearText()
    End Sub

    Public Sub Draw(ByRef display As Surface)
        For Each text As TextSprite In TextSprites
            display.Blit(text)
        Next
    End Sub

    Private Sub ClearText()
        For Each text As TextSprite In TextSprites
            text.Text = ""
        Next
    End Sub

    Public Sub AddTextToBuffer(ByVal text As String)
        TextSprites(0).Text = TextSprites(1).Text
        TextSprites(1).Text = TextSprites(2).Text
        TextSprites(2).Text = TextSprites(3).Text
        TextSprites(3).Text = TextSprites(4).Text
        TextSprites(4).Text = text
    End Sub
End Class
